//
//  UIView+Extension.m
//  DDLock
//
//  Created by ios on 2017/12/25.
//  Copyright © 2017年 saiyi. All rights reserved.
//

#import "UIView+Extension.h"

@implementation UIView (Extension)

- (void)setGg_x:(CGFloat)gg_x {
    CGRect frame = self.frame;
    frame.origin.x = gg_x;
    self.frame = frame;
}

- (CGFloat)gg_x {
    return self.frame.origin.x;
}

- (void)setGg_y:(CGFloat)gg_y {
    CGRect frame = self.frame;
    frame.origin.y = gg_y;
    self.frame = frame;
}

- (CGFloat)gg_y {
    return self.frame.origin.y;
}

- (void)setGg_centerX:(CGFloat)gg_centerX {
    CGPoint center = self.center;
    center.x = gg_centerX;
    self.center = center;
}

- (CGFloat)gg_centerX {
    return self.center.x;
}

- (void)setGg_centerY:(CGFloat)gg_centerY {
    CGPoint center = self.center;
    center.y = gg_centerY;
    self.center = center;
}

- (CGFloat)gg_centerY {
    return self.center.y;
}

- (void)setGg_width:(CGFloat)gg_width {
    CGRect frame = self.frame;
    frame.size.width = gg_width;
    self.frame = frame;
}

- (CGFloat)gg_width {
    return self.frame.size.width;
}

- (void)setGg_height:(CGFloat)gg_height {
    CGRect frame = self.frame;
    frame.size.height = gg_height;
    self.frame = frame;
}

- (CGFloat)gg_height {
    return self.frame.size.height;
}

- (void)setGg_size:(CGSize)gg_size {
    CGRect frame = self.frame;
    frame.size = gg_size;
    self.frame = frame;
}

- (CGSize)gg_size {
    return self.frame.size;
}

- (void)setGg_origin:(CGPoint)gg_origin {
    CGRect frame = self.frame;
    frame.origin = gg_origin;
    self.frame = frame;
}

- (CGPoint)gg_origin {
    return self.frame.origin;
}

- (void)setGg_top:(CGFloat)gg_top {
    CGRect frame = self.frame;
    frame.origin.y = gg_top;
    self.frame = frame;
}

- (CGFloat)gg_top {
    return self.frame.origin.y;
}

- (void)setGg_bottom:(CGFloat)gg_bottom {
    CGRect frame = self.frame;
    frame.origin.y = gg_bottom - frame.size.height;
}

- (CGFloat)gg_bottom {
    return self.frame.origin.y + self.frame.size.height;
}

- (void)setGg_left:(CGFloat)gg_left {
    CGRect frame = self.frame;
    frame.origin.x = gg_left;
    self.frame = frame;
}

- (CGFloat)gg_left {
    return self.frame.origin.x;
}

- (void)setGg_right:(CGFloat)gg_right {
    CGRect frame = self.frame;
    frame.origin.x = gg_right - frame.size.width;
    self.frame = frame;
}

- (CGFloat)gg_right {
    return self.frame.origin.x + self.frame.size.width;
}


+ (instancetype)viewFromXIB {
    
    return [[[UINib nibWithNibName:NSStringFromClass(self) bundle:nil] instantiateWithOwner:nil options:nil] firstObject];
    
}



@end
